package com.xm.spring5.service.impl;

import com.xm.spring5.dao.BookDao;
import com.xm.spring5.entity.Book;
import com.xm.spring5.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookDao bookDao;


    @Override
    public void add(Book book) {
        bookDao.add(book);
    }

    @Override
    public void update(Book book) {
        bookDao.update(book);
    }

    @Override
    public void delete(String id) {
        bookDao.delete(id);

    }

    @Override
    public int findCount() {
        return bookDao.selectCount();
    }

    //查询返回对象
    @Override
    public Book findOne(String id) {
        return bookDao.findBookInfo(id);
    }

    //查询返回集合
    @Override
    public List<Book> findAll() {
        return bookDao.findAllBook();
    }

    //批量添加
    @Override
    public void batchAdd(List<Object[]> batchArgs) {
        bookDao.batchAddBook(batchArgs);
    }

    @Override
    public void batchUpdate(List<Object[]> batchArgs) {
        bookDao.batchUpdateBook(batchArgs);
    }

    @Override
    public void batchDelete(List<Object[]> batchArgs) {
        bookDao.batchDeleteBook(batchArgs);
    }

}
